#include "sandbox.h"
#include <iostream>
#include <fstream>

using json = nlohmann::json;

int main() {
    json config = {
        {"submission_id", "test-001"},
        {"language", "cpp"},
        {"time_limit", 1000},  // 1秒
        {"memory_limit", 65536},  // 64MB
        {"code", "I2luY2x1ZGUgPGlvc3RyZWFtPgppbnQgbWFpbigpIHsKICAgIGludCBhLCBiOwogICAgc3RkOjpjaW4gPj4gYSA+PiBiOwogICAgc3RkOjpjb3V0IDw8IGEgKyBiIDw8IHN0ZDo6ZW5kbDsKICAgIHJldHVybiAwOwp9"},  // Base64编码的C++代码
        {"test_cases", {
            {
                {"case_id", 1},
                {"input", "MSAyCg=="},  // "1 2\n" in Base64
                {"expected_output", "Mwo="}  // "3\n" in Base64
            },
            {
                {"case_id", 2},
                {"input", "MTAwIDIwMAo="},  // "100 200\n" in Base64
                {"expected_output", "MzAwCg=="}  // "300\n" in Base64
            }
        }}
    };

    try {
        // 创建沙箱实例
        judge::Sandbox sandbox;

        // 运行评测
        auto result = sandbox.judge(config);

        // 输出结果
        std::cout << "评测结果：" << std::endl;
        std::cout << resultToJson(result).dump(4) << std::endl;

    } catch (const std::exception& e) {
        std::cerr << "错误：" << e.what() << std::endl;
        return 1;
    }

    return 0;
} 